<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // function getMax(x, y) {
    //   return x > y ? x : y
    // }
    // let re = getMax(1, 3)
    // console.log(re);
    // function getMax(x, y) {
    //   let max = 0
    //   if (x > y) {
    //     max = x
    //   } else {
    //     max = y
    //   }
    //   return max
    // }
    // let re = getMax(6, 3)
    // console.log(re);
    // 2.求任意数组中的最大(小)值并返回这个最大(小)值
    function getMaxArr(arr = []) {
      let max = arr[0]
      let min = arr[0]
      for (let i = 1; i < arr.length; i++) {
        if (max < arr[i]) {
          max = arr[i]
        }
        if (min > arr[i]) {
          min = arr[i]
        }
      }
      return [max, min]
    }
    let re = getMaxArr([11, 22, 12, 32, 14])
    console.log(re);
    let re1 = parseInt('12px')
  </script>
</body>

</html>